<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include('blog-frame/header.php');
?>
<div id="content" class="clearfix">
    <div id="main" class="col620 clearfix" role="main">
			<?php if ( have_posts() ) : ?>
				<header class="page-header">
					<h1 class="page-title"><?php
						printf( __( 'Category Archives: %s', 'living-journal' ), '<span class="yellow">' . single_cat_title( '', false ) . '</span>' );
					?></h1>
				</header>

	<?php while ( have_posts() ) : the_post();$categories = get_the_category( $id );?>
        <article id="post-<?php echo $id;?>" class="post-<?php echo $id;?> post type-post status-publish format-standard hentry category-entertainment category-home-and-family">
            <header class="entry-header">
                <h1 class="entry-title">
                    <a href="<?php echo get_permalink($id);?>" title="<?php echo the_title();?>" rel="bookmark"><?php echo the_title();?></a>
                </h1>
                <div class="entry-meta">
                    <span class="sep">Posted on </span>
                    <time class="entry-date" datetime=""><?php echo get_the_time('Y-m-d', $id);?></time>
                </div>
            </header>
            <div class="entry-content post_content">
                <?php echo word_limiter((apply_filters('the_content',get_post_field('post_content', $id))), 50);?>
                <a href="<?php echo get_permalink(the_ID());?>" class="more-link">Continue reading <span class="meta-nav">→</span></a>
            </div>
            <footer class="entry-meta">
                <span class="cat-links">Posted in&nbsp;
                <?php
                    foreach ($categories as $key=>$category):
                        if($key == 0):
                ?>
                        <a href="<?php echo get_category_link($category->term_id);?>" title="View all posts in <?php echo $category->name;?>" rel="tag"><?php echo $category->name;?>&nbsp;</a>
                <?php
                        else:
                ?>
                        <a href="<?php echo get_category_link($category->term_id);?>" title="View all posts in <?php echo $category->name;?>" rel="tag"><?php echo ','. $category->name;?>,&nbsp;</a>
                <?php
                        endif;
                ?>
                <?php
                    endforeach;
                ?>
            </span>
            </footer>
        </article>
        <?php endwhile; ?>
        <?php
			twentythirteen_paging_nav();
		?>
        <?php
//        if($total_pages != 0):
//            pagination($total_pages,2);
//        endif;
    ?>

			<?php else : ?>

				<article id="post-0" class="post no-results not-found">
					<header class="entry-header">
						<h1 class="entry-title"><?php _e( 'Nothing Found', 'living-journal' ); ?></h1>
					</header><!-- .entry-header -->

					<div class="entry-content post_content">
						<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'living-journal' ); ?></p>
						<?php get_search_form(); ?>
					</div><!-- .entry-content -->
				</article><!-- #post-0 -->

			<?php endif; ?>

        </div> <!-- end #main -->
<div id="sidebar" class="widget-area col300" role="complementary">
	<?php if(is_active_sidebar('cs-blog-right-sidebar')) dynamic_sidebar( 'cs-blog-right-sidebar' ); ?>
</div><!-- #secondary .widget-area -->
<?php
include('blog-frame/footer.php');
?>